/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.context.impl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import com.genia.toolbox.web.context.WebContext;

/**
 * Wrapper around <code>WebContext</code> that allows an application to
 * defined its own <code>WebContext</code> if it needs it.
 */
public class ContextWrapper
    implements WebContext
{
  /**
   * the wrapped <code>WebContext</code>.
   */
  private WebContext webContext;



  /**
   * getter for the webContext property.
   * 
   * @return the webContext
   */
  public WebContext getContext()
  {
    return webContext;
  }



  /**
   * setter for the webContext property.
   * 
   * @param webContext
   *          the webContext to set
   */
  public void setContext(final WebContext webContext)
  {
    this.webContext = webContext;
  }



  /**
   * retrieve the current <code>HttpServletRequest</code>.
   * 
   * @return the current <code>HttpServletRequest</code>
   * @see com.genia.toolbox.web.context.WebContext#getRequest()
   */
  public HttpServletRequest getRequest()
  {
    return getContext().getRequest();
  }



  /**
   * retrieve the current <code>HttpSession</code>.
   * 
   * @return the current <code>HttpSession</code>
   * @see com.genia.toolbox.web.context.WebContext#getSession()
   */
  public HttpSession getSession()
  {
    return getContext().getSession();
  }



  /**
   * Return the relative path associated with the current servlet.
   * 
   * @return the relative path associated with the current servlet
   * @see com.genia.toolbox.web.context.WebContext#getRelativePath()
   */
  public String getRelativePath()
  {
    return getContext().getRelativePath();
  }

}
